$def with (devices)

<script>

 function onDeviceClick(id){

		$$.get("/device_info?byid="+id, function(data) {
			$$("#dev_info").html("</br>" + data + "</br>")
		});
		
		event.preventDefault()
}
	
</script>

<p><strong>Devices:</strong></p>
<table style="width:100%" class="ui-widget ui-widget-content" >
<tr class="ui-widget-header">
	<td>Id</td>
	<td>Name</td>
	<td>Description</td>
	<td>Location</td>
	<td>Role</td>
</tr>
$for dev in devices:
	<tr>
		<td>$dev.id</td>
		<td><a id="$dev.id" href="#" onclick="onDeviceClick(this.id)">$dev.get_name()</a></td>
		<td>$dev.get_desc()</td>
		<td>$dev.get_location()</td>
		<td>$dev.get_role()</td>
	</tr>
<tr>
</tr>
</table>
<div style="width:100%" id="dev_info"></div>